package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.response.MessageResponse;
import com.ytjj.qmyx.admin.service.MessageService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *
 *
 * @Version: 1.0
 *
 * 短信推广 模块
 */
@RestController
@RequestMapping("/message")
public class MessageController {

	@Resource
	private MessageService messageService;

	@GetMapping("/insert")
	@OperLog(operModule = "短信推广管理", operDesc = "新增短信模板", operType = SysLogConstants.OPERATION_ADD)
	@Async
	public CommonResult insertMessage(MessageResponse message) {
		messageService.insertMessage(message);
		return CommonResult.success();
	}

	@GetMapping("/list")
	@OperLog(operModule = "短信推广管理", operDesc = "短信模板列表", operType = SysLogConstants.OPERATION_SELECT)
	public CommonResult selectList() {
		return CommonResult.success(messageService.selectList());
	}
}
